package com.qk.controller;

import com.qk.aop.anno.LogRecord;
import com.qk.common.Result;
import com.qk.dto.user.UserLoginDTO;
import com.qk.service.UserService;
import com.qk.vo.user.UserLoginVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zhangchuang
 * @Date: 2025/10/10 15:49
 * @Description: 登录控制器
 */
@RestController
@Slf4j
public class LoginController {

    @Autowired
    private UserService userService;

    /**
     * 登录
     *
     * @param userLoginDTO 登录信息
     * @return 登录结果
     */
    @PostMapping("/login")
    public Result login(@RequestBody UserLoginDTO userLoginDTO) {
        log.info("登录参数：{}", userLoginDTO);
        UserLoginVO userLoginVO = userService.login(userLoginDTO);
        return Result.success(userLoginVO);
    }

}
